using Headsight.BPMN2WF.BPMN.Schemas;
using Headsight.BPMN2WF.Testing.TestObjCtors;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Rhino.Mocks;

namespace Headsight.BPMN2WF.BPMN.Model
{
    [TestClass]
    public class BPMNProcessFactoryBPMNArgumentTest
    {
        private BPMNArgumentFactory _sut;
        

        [TestInitialize]
        public void SetUp()
        {
        _sut = new BPMNArgumentFactoryImpl();
        }

        [TestMethod]
        public void CreateArgumentsOut_in_case_of_tFlowElement_not_subtype_of_tActivity()
        {
            var tFlowElement = MockRepository.GenerateStub<Schemas.tFlowElement>();

            var actual = _sut.CreateArgumentsOut(tFlowElement);

            Assert.IsNotNull(actual);
            Assert.AreEqual(0, actual.Count);
        }

        [TestMethod]
        public void CreateArgumentsOut_in_case_of_tActivitys_ioSpecification_is_null()
        {
            var tActivity = (tActivity)new tFlowNodeCtor().Create();
            tActivity.ioSpecification = null;

            var actual = _sut.CreateArgumentsOut(tActivity);

            Assert.IsNotNull(actual);
            Assert.AreEqual(0, actual.Count);
        }

        [TestMethod]
        public void CreateArgumentsOut_in_case_of_tActivity_ioSpecifications_dataOutput_is_null()
        {
            var tActivity = (tActivity)new tFlowNodeCtor().Create();
            tActivity.ioSpecification = new tInputOutputSpecification();
            tActivity.ioSpecification.dataOutput = null;

            var actual = _sut.CreateArgumentsOut(tActivity);

            Assert.IsNotNull(actual);
            Assert.AreEqual(0, actual.Count);
        }

        [TestMethod]
        public void CreateArgumentsIn_in_case_of_tFlowElement_not_subtype_of_tActivity()
        {
            var tFlowElement = MockRepository.GenerateStub<Schemas.tFlowElement>();

            var actual = _sut.CreateArgumentsIn(tFlowElement);

            Assert.IsNotNull(actual);
            Assert.AreEqual(0, actual.Count);
        }

        [TestMethod]
        public void CreateArgumentsIn_in_case_of_tActivitys_ioSpecification_is_null()
        {
            var tActivity = (tActivity)new tFlowNodeCtor().Create();
            tActivity.ioSpecification = null;

            var actual = _sut.CreateArgumentsIn(tActivity);

            Assert.IsNotNull(actual);
            Assert.AreEqual(0, actual.Count);
        }

        [TestMethod]
        public void CreateArgumentsIn_in_case_of_tActivity_ioSpecifications_dataInput_is_null()
        {
            var tActivity = (tActivity)new tFlowNodeCtor().Create();
            tActivity.ioSpecification = new tInputOutputSpecification();
            tActivity.ioSpecification.dataInput = null;

            var actual = _sut.CreateArgumentsIn(tActivity);

            Assert.IsNotNull(actual);
            Assert.AreEqual(0, actual.Count);
        }
    }
}